/* -----------------------------------------------------------
 * Author: Marie Caswell
 * Testing Function: Adventurer Card - Random Tester

 * Description: Tests the adventurer card effect with randomly generated initialization parameters
 * for coins, hand count, and deck count.
 -----------------------------------------------------------*/

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "rngs.h"
#include <time.h>

#define MAX_HAND 500
#define MAX_DECK 500

int main()
 {
 	
srand(time(NULL));
int seed = 1000;
int numPlayer = 2;
struct gameState G;
int null = 0;
int k[10] = {adventurer, outpost, salvager, village, minion, feast, mine, sea_hag, estate, smithy};
memset(&G, 23, sizeof(struct gameState));   // clear the game state
initializeGame(numPlayer, k, seed, &G); // initialize a new game 
G.handCount[0] = rand() % MAX_HAND; //randomize initial hand count for player 1
G.deckCount[0] = rand() % MAX_DECK; // randomize initial deck count
G.coins = rand() % 100; //randomize initial coin count

printf("\nInitial Deck Count: %d\n", G.deckCount[0]);
int deckTracker = G.deckCount[0];
printf("Initial Hand Count: %d\n", G.handCount[0]);
int countTracker = G.handCount[0];
printf("Initial Coin Count: %d\n", G.coins);
printf("Initial Discard Count: %d\n\n", G.discardCount[0]);
//int coinTracker = G.coins;

cardEffect(adventurer, null, null, null, &G, 4, &null);	//play adventurer with randomly generated parameters

assert(G.handCount[0] == (countTracker + 2)); //check to see that card count correctly incremented by 2
printf("Post-Adventurer Coin Count: %d\n", G.coins);
printf("Post-Adventurer Discard Count: %d\n", G.discardCount[0]);
printf("Post-Adventurer Deck Count: %d\n", G.deckCount[0]);
assert(G.deckCount[0] == (deckTracker - G.discardCount[0] - 1));
printf("Post-Adventurer Hand Count: %d\n\n", G.handCount[0]);

printf("\nTests Passed\n\n");

 	return 0;
 }
